<?php
$cs=Yii::app()->clientScript;
$cs->registerScriptFile(Yii::app()->request->baseUrl."/js/ckeditor/ckeditor.js");
$cs->registerScript("form", '
             //Start ckeditor setup
            if ( typeof CKEDITOR == "undefined" ){
	            document.write("CKEditor not found." ) ;
            } else {
	            //ckeditor
                var editor = CKEDITOR.replace( "MenuItem_description", {
                height: "120"
                });
            }
            //End ckeditor setup
            ', CClientScript::POS_END);
?>

<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'menu-item-form',
	'enableAjaxValidation'=>false,
)); ?>

    <?php echo $form->hiddenField($model, 'menu_id', array('name'=>'mId'))?>
	<p class="note"><?php echo strtr(Yii::t('BackEnd', 'The fields {*} are required.'), array('{*}'=>'<span class="required">*</span>'))?></p>

    <table id="menuItem-basic-info" class="form-view">
            <tr class="even">
                <th><?php echo $form->labelEx($model,'Parent item'); ?></th>
                <td>
                    <?php echo $form->dropDownList($model,'parent_id', Common::parent_menu_arr($model->parent_id)); ?>
                    <?php echo $form->error($model,'parent_id'); ?>
				</td>
            </tr>
            <tr class="odd">
                <th><?php echo $form->labelEx($model,'name'); ?></th>
                <td>
                    <?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>255)); ?>
                    <?php echo $form->error($model,'name'); ?>
                </td>
            </tr>
            <tr class="even">
                <th><?php echo $form->labelEx($model,'link'); ?></th>
                <td>
                    <?php echo $form->textField($model,'link',array('size'=>60,'maxlength'=>255)); ?>
                    <?php echo $form->error($model,'link'); ?>
                </td>
            </tr>
            <tr class="odd">
                <th><?php echo $form->labelEx($model,'description'); ?></th>
                <td>
                    <?php echo $form->textArea($model,'description',array('rows'=>6, 'cols'=>50)); ?>
                    <?php echo $form->error($model,'description'); ?>
                </td>
            </tr>
            <tr class="even">
                <th><?php echo $form->labelEx($model,'options'); ?></th>
                <td>
                    <?php echo $form->textArea($model,'options',array('rows'=>6, 'cols'=>50)); ?>
                    <br/>
                    <?php echo Yii::t('BackEnd', 'Structure of option as follow: <b>target:_blak;title:Title</b>')?>
                    <?php echo $form->error($model,'options'); ?>
                </td>
            </tr>
            <tr class="odd">
                <th><?php echo $form->labelEx($model,'status'); ?></th>
                <td>
                    <?php echo $form->dropDownList($model,'status', array(MenuItem::STATUS_ENABLED=>Yii::t('BackEnd', 'Enabled'), MenuItem::STATUS_DISABLED=>Yii::t('BackEnd', 'Disabled'))); ?>
                    <?php echo $form->error($model,'status'); ?>
                </td>
            </tr>
            <tr class="even">
                <th><?php echo $form->labelEx($model,'sorder'); ?></th>
                <td>
                    <?php echo $form->textField($model, 'sorder', array('class'=>'numbersOnly')); ?>
                    <?php echo $form->error($model,'sorder'); ?>
                </td>
            </tr>
    </table>
    <input type="submit" style="display:none"/>
<?php $this->endWidget(); ?>

</div><!-- form -->